package org.cllib.math;

public class Digit {
	private Range range;
	private int current;

	public Digit() {
		range = new Range(9);
	}

	public Digit(Range range) {
		super();
		this.range = range;
		reset();
	}

	public boolean isFull() {
		return current >= range.getMax();
	}

	public void count() {
		current++;
	}

	public void reset() {
		current = range.getMin();
	}

	public int getCurrent() {
		return current;
	}

	public void setValue(int n) {
		if (n < range.min || n > range.max) {
			throw new IllegalStateException("invalid value [" + n
					+ "] for digit valid range " + range);
		}
		this.current = n;
	}

	public BigNumber add(BigNumber bn) {
		return null;
	}

	public String toString() {
		return String.valueOf(current);
	}
}
